﻿using System;

namespace triangle03
{
    class Program
    {
        static void Main(string[] args)
        {
            int intN = -1;
            while (intN <0)
            {
                Console.Write("请输入行数（0表示结束）：");
                string strN = Console.ReadLine();
                int.TryParse(strN, out intN);
            }
            if (intN >0)
            {
                for (int i = 1; i <= intN; i++)
                {
                    for (int j = 1; j<=intN -i ; j++)
                    {
                        Console.Write(" ");
                    }
                    for (int j = 1; j < 2*i; j++)
                    {
                        Console.Write("*");
                    }
                    Console.WriteLine("");
                }
                for (int i = intN -1; i >= 1; i--)
                {
                    for (int j = 1; j <= intN -i; j++)
                    {
                        Console.Write(" ");
                    }
                    for (int j = 1; j < 2*i; j++)
                    {
                        Console.Write("*");
                    }
                    Console.WriteLine("");
                }
            }
            Console.WriteLine("按任意键结束…");
            Console.ReadKey();
        }
    }
}
